﻿@model  XW.Data.SysUser
@{
	ViewData["Title"] = "首页"; 
	// var user = ViewData["CurrentUser"] as XW.Data.SysUser;
}
@section css{
  <style>
        .layui-form-item .layui-input-company {
            width: auto;
            padding-right: 10px;
            line-height: 38px;
        }
    </style>
}
 
    <div class="layuimini-container">
        <div class="layuimini-main">

            <div class="layui-form layuimini-form">
            <div class="layui-form-item">
                <input type="hidden" name="id" value="@Model.Id" />

                <label for="Account" class="layui-form-label">账号</label>
                <div class="layui-input-block">

                    <input type="text" name="Account" id="Account" disabled readonly value="@Model.Account" class="layui-input" />
                    <tip>填写自己账号的名称。</tip>
                </div>
            </div>
            <div class="layui-form-item"> 
                <label for="NickName" class="layui-form-label required">昵称</label>
                <div class="layui-input-block">

                    <input type="text" name="NickName" id="NickName" value="@Model.NickName" class="layui-input" lay-verify="required" lay-reqtext="昵称不能为空" placeholder="请输入昵称" />
                </div>
            </div>
                <div class="layui-form-item">
                <label class="layui-form-label required" for="Phone">手机</label>
                    <div class="layui-input-block">
                    <input type="number" id="Phone" name="Phone" lay-verify="required|phone" lay-reqtext="手机不能为空" placeholder="请输入手机" value="@Model.Phone" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label" for="Email">邮箱</label>
                    <div class="layui-input-block">
                    <input type="email" name="Email" id="Email" lay-verify="email" placeholder="请输入邮箱" value="@Model.Email" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                <label class="layui-form-label" for="Introduc">备注信息</label>
                    <div class="layui-input-block">
                        <textarea name="Introduc" id="Introduc" class="layui-textarea" placeholder="请输入备注信息" >@Model.Introduc</textarea>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
                    </div>
                </div>
            </div>
        </div>
    </div> 
    @section js
    {
        <script type="text/javascript">
            layui.use(['form', 'miniTab'], function () {
                var $ = layui.jquery;
                var form = layui.form,
                    layer = layui.layer,
                    miniTab = layui.miniTab; 
                //监听提交
                form.on('submit(saveBtn)', function (data) {
                        var loadIndex = layer.load(3);
                        $.ajax({
                            url: '@(Url.Content("~/Home/AjaxProfileUpdate"))',
                            data: data.field,
                            method: 'post',
                            success: function (d) { 
                                 layer.close(loadIndex);
                                if (d.resultCode == "200") { 
                                    parent.layer.msg('保存成功',{icon: 1,offset:'t',shade:0.3}, function () {
                                         miniTab.deleteCurrentByIframe();
                                    }); 
                                } else { 
                                    layer.msg(d.message);
                                     
                                } 
                            },
                            error: function (e) {
                                // console.log(e);
                                layer.close(loadIndex);
                            }
                        });

                    // var index = layer.alert(JSON.stringify(data.field), {
                    //     title: '最终的提交信息'
                    // }, function () {
                    //     layer.close(index);
                    //     miniTab.deleteCurrentByIframe();
                    // });
                    return false;
                });

            });
        </script>
    } 